home *** CD-ROM | disk | FTP | other *** search
- /*
- ** Apple Macintosh Developer Technical Support
- **
- ** File: TExtSelectObj.c
- ** Written by: Eric Soldan
- **
- ** Copyright © 1993 Apple Computer, Inc.
- ** All rights reserved.
- */
-
- /* You may incorporate this sample code into your applications without
- ** restriction, though the sample code has been provided "AS IS" and the
- ** responsibility for its operation is 100% yours. However, what you are
- ** not permitted to do is to redistribute the source as "DSC Sample Code"
- ** after having made changes. If you're going to re-distribute the source,
- ** we require that you make it clear in the source that the code was
- ** descended from Apple Sample Code, but that you've made changes. */
-
- /* See the files "=How to write your app" and "=Using TreeObj.c" for information
- ** on this function. */
-
- /* This file implements the messages for the round-rect object. Many of the messages
- ** can be handled by the rect object, as they deal with a rect structure. Only
- ** a few of them are round-rect-specific. */
-
- /* It would seem that you would want a custom hit-test message handler here, but
- ** the rect object first checks to see if the hit is within the bounding box of
- ** the object, and if so, it then calls the object to return the region. This
- ** allows the rect object to generically handle hit-testing. */
-
-
-
- /*****************************************************************************/
-
-
-
- #include "App.h" /* Get the application includes/typedefs, etc. */
- #include "App.protos.h" /* Get the prototypes for the application. */
-
- #ifndef __OSEVENTS__
- #include <OSEvents.h>
- #endif
-
- #ifndef __OSUTILS__
- #include <OSUtils.h>
- #endif
-
- #ifndef __QUICKDRAW__
- #include <Quickdraw.h>
- #endif
-
- #ifndef __TREEOBJ2__
- #include "TreeObj2.h"
- #endif
-
- #ifndef __UTILITIES__
- #include "Utilities.h"
- #endif
-
-
-
- /*****************************************************************************/
-
-
-
- static ExtSelectObjPeek *gMWERKSDebug;
- /* For Metroweks debugging of AppsToGo "objects", you need an instance of the
- ** same type you wish to view it in the debugger. Now we have an instance. */
-
-
-
- /*****************************************************************************/
- /*****************************************************************************/
-
- #ifdef applec
- #pragma segment DTSDrawSeg2
- #endif
-
- /*****************************************************************************/
- /*****************************************************************************/
-
-
-
- long TExtSelectObj(TreeObjHndl hndl, short message, long data)
- {
- Rect rct;
- RgnHandle rgn, accumRgn;
-
- switch (message) {
- case FREEMESSAGE:
- case COPYMESSAGE:
- case UNDOMESSAGE:
- case CONVERTMESSAGE:
- case FREADMESSAGE:
- case FWRITEMESSAGE:
- case HREADMESSAGE:
- case HWRITEMESSAGE:
- case HITTESTMESSAGE:
- case GETOBJRECTMESSAGE:
- case SETOBJRECTMESSAGE:
- case SECTOBJRECTMESSAGE:
- case GETBBOXMESSAGE:
- case CLICKMESSAGE:
- case KEYMESSAGE:
- case SETSELECTMESSAGE:
- case GETSELECTMESSAGE:
- case SIZEMESSAGE:
- case COMPAREMESSAGE:
- return(TRectObj(hndl, message, data));
- break;
-
- case INITMESSAGE:
- break;
-
- case GETRGNMESSAGE:
- rgn = NewRgn();
- accumRgn = (RgnHandle)data;
- if (accumRgn)
- if (GetHandleSize((Handle)accumRgn) > 10000)
- return((long)rgn);
- rct = mDerefCommon(hndl)->rect;
- RectRgn(rgn, &rct);
- if (accumRgn)
- UnionRgn(rgn, accumRgn, accumRgn);
- return((long)rgn);
- break;
-
- case DRAWMESSAGE:
- rct = mDerefRRect(hndl)->rect;
- switch (data) {
- case DRAWOBJ:
- PenMode(patXor);
- PenPat((ConstPatternParam)&qd.gray);
- FrameRect(&rct);
- PenNormal();
- break;
- case ERASEOBJ:
- EraseRect(&rct);
- break;
- }
- break;
-
- case PRINTMESSAGE:
- break;
-
- case VHMESSAGE:
- break;
-
- default:
- break;
- }
-
- return(noErr);
- }
-
-
-
-